/*
 * JFrame_Library.java
 *
 * Created on Mar 13, 2012, 10:14:35 AM
 */
package gui;

import entity.Book;
import entity.Category;
import entity.Department;
import entity.Employee;
import entity.Orders;
import entity.OrdersDetails;
import java.awt.CardLayout;
import java.awt.Color;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import manager.Manager;
import model.BookInOrdersTableModel;
import model.BookToPayTableModel;
import model.DetailsEmployeeBorrowBooksTableModel;
import model.DetailsEmployeePayAFineTableModel;
import model.EmployeeBorrowBooksTableModel;
import model.EmployeeFineTableModel;
import model.HistoryBookTableModel;
import model.HistoryEmployeeTableModel;
import model.MostBorrowedBookTableModel;
import model.OrderDetailsByOrdersIDTableModel;
import model.OrdersDetailsByBookIDTableModel;

/**
 *
 * @author Noi
 */
public class JFrame_Library extends javax.swing.JFrame {

    /** Creates new form JFrame_Library */
    public JFrame_Library() {
        initComponents();
        
        this.setLocationRelativeTo(null);
        
        manager = new Manager();
        
        manager.loadDataToDepartmentManager();
        manager.loadDataToEmployeeManager();
        manager.loadDataToCategoryManager();
        manager.loadDataToBookManager();
        manager.loadDataToOrdersManager();
        manager.loadDataToOrdersDetailsManager();
        
        this.initIssueDate();
        this.refreshJPanelBorrowBook();
    }
    
    private void refreshJPanelBorrowBook() {
        this.loadToCategoryComboBoxModel();
        this.loadToDepartmentComboBoxModel();
        this.loadToEmployeeComboBoxModelByDepartmentSelected((Department) this.cbbDepartmentForBorrowBook.getSelectedItem());
        this.loadToListBookByCategoryForBorrowBookModel(((Category) this.cbbCategoryForBorrowBook.getSelectedItem()).getCategoryID());
        this.setTextFields((Employee) this.cbbEmployeeForBorrowBook.getSelectedItem());
    }
    
    private void initModelForPayBook() {
        this.payModel = new BookToPayTableModel(this.manager);
        this.tblBooksToPay.setModel(payModel);
        
        this.ordersModel = new BookInOrdersTableModel(this.manager);
        this.tblBooksInOrders.setModel(ordersModel);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroupFindForPayBook = new javax.swing.ButtonGroup();
        buttonGroupFindBookForHistoryBook = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        btnEmployeeManager = new javax.swing.JButton();
        btnUserManager = new javax.swing.JButton();
        btnBookManager = new javax.swing.JButton();
        btnBorrowBook = new javax.swing.JButton();
        btnPayBook = new javax.swing.JButton();
        btnStatistic = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        lblFunction = new javax.swing.JLabel();
        pnlCenter = new javax.swing.JPanel();
        pnlPicture = new javax.swing.JPanel();
        pnlBorrowBook = new javax.swing.JPanel();
        pnlInformation = new javax.swing.JPanel();
        cbbDepartmentForBorrowBook = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        cbbEmployeeForBorrowBook = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        dateIssueForBorrowBook = new com.toedter.calendar.JDateChooser();
        jLabel7 = new javax.swing.JLabel();
        txtNumberForBookBorrow = new javax.swing.JTextField();
        txtCanBorrowBooks = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        pnlCart = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jPanel12 = new javax.swing.JPanel();
        cbbCategoryForBorrowBook = new javax.swing.JComboBox();
        jPanel13 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        listBookByCategoryForBorrowBook = new javax.swing.JList();
        jPanel10 = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        btnCreateOrders = new javax.swing.JButton();
        jPanel15 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        listBookForBorrowBook = new javax.swing.JList();
        jPanel11 = new javax.swing.JPanel();
        jPanel21 = new javax.swing.JPanel();
        btnAddToCart = new javax.swing.JButton();
        btnRemoveFromCart = new javax.swing.JButton();
        jPanel22 = new javax.swing.JPanel();
        pnlPayBook = new javax.swing.JPanel();
        pnlFindBooksForPayBook = new javax.swing.JPanel();
        rdFindEmployeeIDForPayBook = new javax.swing.JRadioButton();
        rdFindOrdersIDForPayBook = new javax.swing.JRadioButton();
        jLabel11 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtFindForPayBook = new javax.swing.JTextField();
        btnFindForPayBook = new javax.swing.JButton();
        pnlResultForPayBook = new javax.swing.JPanel();
        pnlResultFindForPayBook = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        txtEmployeeIDForPayBookByOrdersID = new javax.swing.JTextField();
        txtEmployeeNameForPayBookByOrdersID = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        btnSelectBookToPay = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tblBooksInOrders = new javax.swing.JTable();
        pnlCertificationForPayBook = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tblBooksToPay = new javax.swing.JTable();
        jPanel17 = new javax.swing.JPanel();
        btnSavePayBook = new javax.swing.JButton();
        jPanel18 = new javax.swing.JPanel();
        jPanel19 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        txtAmount = new javax.swing.JTextField();
        jPanel20 = new javax.swing.JPanel();
        btnPutBackOrders = new javax.swing.JButton();
        pnlEmployeeManager = new javax.swing.JPanel();
        pnlBookManager = new javax.swing.JPanel();
        pnlStatistic = new javax.swing.JPanel();
        pnlHeaderStatistic = new javax.swing.JPanel();
        pnlStatisticHistoryBooks = new javax.swing.JPanel();
        lblHistoryBooks = new javax.swing.JLabel();
        pnlStatisticHistoryEmployee = new javax.swing.JPanel();
        lblHistoryEmployee = new javax.swing.JLabel();
        pnlStatisticMostBorrowedBook = new javax.swing.JPanel();
        lblMostBorrowedBook = new javax.swing.JLabel();
        pnlEmployeesBorrowedMost = new javax.swing.JPanel();
        lblEmployeeBorrowedMost = new javax.swing.JLabel();
        pnlBorrowBooksOverDue = new javax.swing.JPanel();
        lblBorrowBooksOverDue = new javax.swing.JLabel();
        pnlStatisticCenter = new javax.swing.JPanel();
        pnlHistoryBooks = new javax.swing.JPanel();
        jPanel23 = new javax.swing.JPanel();
        jPanel29 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        txtFindHistoryBook = new javax.swing.JTextField();
        btnFindHistoryBook = new javax.swing.JButton();
        jPanel30 = new javax.swing.JPanel();
        rdBookIDForHistoryBook = new javax.swing.JRadioButton();
        rdBookTitleForHistoryBook = new javax.swing.JRadioButton();
        jPanel24 = new javax.swing.JPanel();
        jPanel31 = new javax.swing.JPanel();
        jPanel32 = new javax.swing.JPanel();
        jPanel25 = new javax.swing.JPanel();
        lblBookIDForHistoryBook = new javax.swing.JLabel();
        lblBookNameForHistoryBook = new javax.swing.JLabel();
        txtBookNameForHistoryBook = new javax.swing.JTextField();
        cbbBookIDForHistoryBook = new javax.swing.JComboBox();
        jPanel26 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        tblHistoryBook = new javax.swing.JTable();
        pnlHistoryEmployee = new javax.swing.JPanel();
        jPanel27 = new javax.swing.JPanel();
        jPanel34 = new javax.swing.JPanel();
        jPanel35 = new javax.swing.JPanel();
        lblFindEmployeeForHistoryEmployee = new javax.swing.JLabel();
        txtFindHistoryEmployee = new javax.swing.JTextField();
        btnFindHistoryEmployee = new javax.swing.JButton();
        jPanel28 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        tblOrdersDetailsForHistoryEmployee = new javax.swing.JTable();
        jPanel33 = new javax.swing.JPanel();
        jPanel36 = new javax.swing.JPanel();
        lblEmployeeIDForHistoryEmployee = new javax.swing.JLabel();
        lblEmployeeNameForHistoryEmployee = new javax.swing.JLabel();
        txtEmployeeNameForHistoryEmployee = new javax.swing.JTextField();
        cbbEmployeeIDForHistoryEmployee = new javax.swing.JComboBox();
        txtDepartmentForHistoryEmployee = new javax.swing.JTextField();
        lblDepartmentForHistoryEmployee = new javax.swing.JLabel();
        jPanel37 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        tblHistoryEmployeeForEmployee = new javax.swing.JTable();
        pnlMostBorrowedBook = new javax.swing.JPanel();
        jPanel38 = new javax.swing.JPanel();
        jPanel41 = new javax.swing.JPanel();
        cbbCategoryForMostBorrowedBook = new javax.swing.JComboBox();
        jPanel39 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        tblOrdersDetailsForMostBorrowedBook = new javax.swing.JTable();
        jPanel40 = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        tblMostBorrowedBook = new javax.swing.JTable();
        pnlEmployeeBorrowBooks = new javax.swing.JPanel();
        jPanel42 = new javax.swing.JPanel();
        jPanel45 = new javax.swing.JPanel();
        cbbDepartmentForEmloyeeBorrowBooks = new javax.swing.JComboBox();
        jPanel43 = new javax.swing.JPanel();
        jScrollPane11 = new javax.swing.JScrollPane();
        tblDetailsBorrowBooksOfEmployee = new javax.swing.JTable();
        jPanel44 = new javax.swing.JPanel();
        jPanel46 = new javax.swing.JPanel();
        jPanel48 = new javax.swing.JPanel();
        lblNumberOfBooksBorrowed = new javax.swing.JLabel();
        lblResultNumberOfBookBorrowed = new javax.swing.JLabel();
        jPanel49 = new javax.swing.JPanel();
        lblOutstandingBooks = new javax.swing.JLabel();
        lblResultOutstandingBooks = new javax.swing.JLabel();
        jPanel47 = new javax.swing.JPanel();
        jScrollPane10 = new javax.swing.JScrollPane();
        tblEmployeeForEmployeeBorrowBooks = new javax.swing.JTable();
        pnlFines = new javax.swing.JPanel();
        jPanel50 = new javax.swing.JPanel();
        jPanel53 = new javax.swing.JPanel();
        lblEmployeeNameForFines = new javax.swing.JLabel();
        txtEmployeeNameForFines = new javax.swing.JTextField();
        btnFindEmployeeForFines = new javax.swing.JButton();
        jPanel51 = new javax.swing.JPanel();
        jScrollPane13 = new javax.swing.JScrollPane();
        tblDetailsEmployeePayAFine = new javax.swing.JTable();
        jPanel52 = new javax.swing.JPanel();
        jScrollPane12 = new javax.swing.JScrollPane();
        tblEmployeesPayAFine = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Library Management System");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(102, 102, 102)));
        jPanel1.setPreferredSize(new java.awt.Dimension(1000, 80));
        jPanel1.setLayout(new java.awt.BorderLayout());

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Library Management System");
        jPanel1.add(jLabel1, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);

        jPanel2.setPreferredSize(new java.awt.Dimension(1000, 520));
        jPanel2.setLayout(new java.awt.BorderLayout());

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel4.setPreferredSize(new java.awt.Dimension(170, 520));

        btnEmployeeManager.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnEmployeeManager.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\reader.png")); // NOI18N
        btnEmployeeManager.setText("Employee");
        btnEmployeeManager.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEmployeeManagerActionPerformed(evt);
            }
        });

        btnUserManager.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnUserManager.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\admin.png")); // NOI18N
        btnUserManager.setText("User");
        btnUserManager.setPreferredSize(new java.awt.Dimension(97, 33));

        btnBookManager.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnBookManager.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\book.png")); // NOI18N
        btnBookManager.setText("Book");
        btnBookManager.setPreferredSize(new java.awt.Dimension(89, 33));

        btnBorrowBook.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnBorrowBook.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\order.png")); // NOI18N
        btnBorrowBook.setText("Borrow Book");
        btnBorrowBook.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBorrowBookActionPerformed(evt);
            }
        });

        btnPayBook.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnPayBook.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\returnbook.png")); // NOI18N
        btnPayBook.setText("Pay Book");
        btnPayBook.setPreferredSize(new java.awt.Dimension(109, 33));
        btnPayBook.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPayBookActionPerformed(evt);
            }
        });

        btnStatistic.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnStatistic.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\statistic.png")); // NOI18N
        btnStatistic.setText("Statistic");
        btnStatistic.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnStatisticActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnPayBook, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
                    .addComponent(btnBorrowBook, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
                    .addComponent(btnUserManager, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
                    .addComponent(btnBookManager, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
                    .addComponent(btnEmployeeManager, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
                    .addComponent(btnStatistic, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnEmployeeManager)
                .addGap(11, 11, 11)
                .addComponent(btnUserManager, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnBookManager, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnBorrowBook)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnPayBook, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnStatistic)
                .addContainerGap(252, Short.MAX_VALUE))
        );

        jPanel2.add(jPanel4, java.awt.BorderLayout.LINE_START);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel5.setPreferredSize(new java.awt.Dimension(750, 520));
        jPanel5.setLayout(new java.awt.BorderLayout());

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel3.setPreferredSize(new java.awt.Dimension(722, 45));
        jPanel3.setLayout(new java.awt.BorderLayout());

        lblFunction.setFont(new java.awt.Font("Tahoma", 1, 16));
        lblFunction.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel3.add(lblFunction, java.awt.BorderLayout.CENTER);

        jPanel5.add(jPanel3, java.awt.BorderLayout.PAGE_START);

        pnlCenter.setLayout(new java.awt.CardLayout());

        javax.swing.GroupLayout pnlPictureLayout = new javax.swing.GroupLayout(pnlPicture);
        pnlPicture.setLayout(pnlPictureLayout);
        pnlPictureLayout.setHorizontalGroup(
            pnlPictureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 758, Short.MAX_VALUE)
        );
        pnlPictureLayout.setVerticalGroup(
            pnlPictureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 471, Short.MAX_VALUE)
        );

        pnlCenter.add(pnlPicture, "card1");

        pnlBorrowBook.setLayout(new java.awt.BorderLayout());

        pnlInformation.setBorder(javax.swing.BorderFactory.createTitledBorder("Information"));
        pnlInformation.setPreferredSize(new java.awt.Dimension(350, 609));

        cbbDepartmentForBorrowBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        cbbDepartmentForBorrowBook.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbbDepartmentForBorrowBook.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbbDepartmentForBorrowBookItemStateChanged(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel3.setText("Department:");

        cbbEmployeeForBorrowBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        cbbEmployeeForBorrowBook.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbbEmployeeForBorrowBook.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbbEmployeeForBorrowBookItemStateChanged(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel4.setText("Employee:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel5.setText("Issue Date:");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel7.setText("Number of borrowed:");

        txtNumberForBookBorrow.setFont(new java.awt.Font("Tahoma", 0, 12));

        txtCanBorrowBooks.setFont(new java.awt.Font("Tahoma", 0, 12));

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel8.setText("Can borrow books:");

        javax.swing.GroupLayout pnlInformationLayout = new javax.swing.GroupLayout(pnlInformation);
        pnlInformation.setLayout(pnlInformationLayout);
        pnlInformationLayout.setHorizontalGroup(
            pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlInformationLayout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlInformationLayout.createSequentialGroup()
                        .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addGroup(pnlInformationLayout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addGap(27, 27, 27)
                                .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtCanBorrowBooks, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                                    .addComponent(txtNumberForBookBorrow, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))))
                        .addContainerGap(26, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlInformationLayout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addContainerGap())
                    .addGroup(pnlInformationLayout.createSequentialGroup()
                        .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel3))
                        .addGap(60, 60, 60)
                        .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbbDepartmentForBorrowBook, 0, 151, Short.MAX_VALUE)
                            .addComponent(cbbEmployeeForBorrowBook, 0, 151, Short.MAX_VALUE)
                            .addComponent(dateIssueForBorrowBook, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))
                        .addGap(26, 26, 26))))
        );
        pnlInformationLayout.setVerticalGroup(
            pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlInformationLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel3)
                    .addComponent(cbbDepartmentForBorrowBook, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addComponent(cbbEmployeeForBorrowBook, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32)
                .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(dateIssueForBorrowBook, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(35, 35, 35)
                .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7)
                    .addComponent(txtNumberForBookBorrow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(34, 34, 34)
                .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel8)
                    .addComponent(txtCanBorrowBooks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(173, Short.MAX_VALUE))
        );

        pnlBorrowBook.add(pnlInformation, java.awt.BorderLayout.LINE_START);

        pnlCart.setBorder(javax.swing.BorderFactory.createTitledBorder("Add to cart"));
        pnlCart.setLayout(new java.awt.BorderLayout());

        jPanel9.setPreferredSize(new java.awt.Dimension(356, 230));
        jPanel9.setLayout(new java.awt.BorderLayout());

        jPanel12.setPreferredSize(new java.awt.Dimension(356, 30));
        jPanel12.setLayout(new java.awt.BorderLayout());

        cbbCategoryForBorrowBook.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbbCategoryForBorrowBook.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbbCategoryForBorrowBookItemStateChanged(evt);
            }
        });
        jPanel12.add(cbbCategoryForBorrowBook, java.awt.BorderLayout.CENTER);

        jPanel9.add(jPanel12, java.awt.BorderLayout.PAGE_START);

        jPanel13.setLayout(new java.awt.BorderLayout());

        listBookByCategoryForBorrowBook.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane2.setViewportView(listBookByCategoryForBorrowBook);

        jPanel13.add(jScrollPane2, java.awt.BorderLayout.CENTER);

        jPanel9.add(jPanel13, java.awt.BorderLayout.CENTER);

        pnlCart.add(jPanel9, java.awt.BorderLayout.PAGE_START);

        jPanel10.setPreferredSize(new java.awt.Dimension(356, 180));
        jPanel10.setLayout(new java.awt.BorderLayout());

        jPanel14.setPreferredSize(new java.awt.Dimension(356, 40));

        btnCreateOrders.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnCreateOrders.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\add.png")); // NOI18N
        btnCreateOrders.setText("Create ");
        btnCreateOrders.setPreferredSize(new java.awt.Dimension(120, 33));
        btnCreateOrders.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCreateOrdersActionPerformed(evt);
            }
        });
        jPanel14.add(btnCreateOrders);

        jPanel10.add(jPanel14, java.awt.BorderLayout.PAGE_END);

        jPanel15.setLayout(new java.awt.BorderLayout());

        listBookForBorrowBook.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(listBookForBorrowBook);

        jPanel15.add(jScrollPane1, java.awt.BorderLayout.CENTER);

        jPanel10.add(jPanel15, java.awt.BorderLayout.CENTER);

        pnlCart.add(jPanel10, java.awt.BorderLayout.PAGE_END);

        jPanel11.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jPanel11.setMinimumSize(new java.awt.Dimension(326, 35));
        jPanel11.setPreferredSize(new java.awt.Dimension(356, 35));
        jPanel11.setLayout(new java.awt.BorderLayout());

        jPanel21.setPreferredSize(new java.awt.Dimension(356, 35));
        jPanel21.setLayout(new java.awt.GridLayout(1, 0));

        btnAddToCart.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnAddToCart.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\add-to-cart.png")); // NOI18N
        btnAddToCart.setText("Add to cart");
        btnAddToCart.setPreferredSize(new java.awt.Dimension(131, 30));
        btnAddToCart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddToCartActionPerformed(evt);
            }
        });
        jPanel21.add(btnAddToCart);

        btnRemoveFromCart.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnRemoveFromCart.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\cart_remove.png")); // NOI18N
        btnRemoveFromCart.setText("Remove from cart");
        btnRemoveFromCart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRemoveFromCartActionPerformed(evt);
            }
        });
        jPanel21.add(btnRemoveFromCart);

        jPanel11.add(jPanel21, java.awt.BorderLayout.PAGE_START);

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 392, Short.MAX_VALUE)
        );
        jPanel22Layout.setVerticalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 2, Short.MAX_VALUE)
        );

        jPanel11.add(jPanel22, java.awt.BorderLayout.CENTER);

        pnlCart.add(jPanel11, java.awt.BorderLayout.CENTER);

        pnlBorrowBook.add(pnlCart, java.awt.BorderLayout.CENTER);

        pnlCenter.add(pnlBorrowBook, "card2");

        pnlPayBook.setLayout(new java.awt.BorderLayout());

        pnlFindBooksForPayBook.setBorder(javax.swing.BorderFactory.createTitledBorder("Find"));
        pnlFindBooksForPayBook.setPreferredSize(new java.awt.Dimension(722, 50));
        pnlFindBooksForPayBook.setLayout(new javax.swing.BoxLayout(pnlFindBooksForPayBook, javax.swing.BoxLayout.LINE_AXIS));

        buttonGroupFindForPayBook.add(rdFindEmployeeIDForPayBook);
        rdFindEmployeeIDForPayBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        rdFindEmployeeIDForPayBook.setText("EmployeeID");
        rdFindEmployeeIDForPayBook.setPreferredSize(new java.awt.Dimension(100, 23));
        pnlFindBooksForPayBook.add(rdFindEmployeeIDForPayBook);

        buttonGroupFindForPayBook.add(rdFindOrdersIDForPayBook);
        rdFindOrdersIDForPayBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        rdFindOrdersIDForPayBook.setSelected(true);
        rdFindOrdersIDForPayBook.setText("OrdersID");
        rdFindOrdersIDForPayBook.setPreferredSize(new java.awt.Dimension(120, 23));
        pnlFindBooksForPayBook.add(rdFindOrdersIDForPayBook);

        jLabel11.setPreferredSize(new java.awt.Dimension(80, 14));
        pnlFindBooksForPayBook.add(jLabel11);

        jLabel2.setPreferredSize(new java.awt.Dimension(100, 23));
        pnlFindBooksForPayBook.add(jLabel2);

        txtFindForPayBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        txtFindForPayBook.setPreferredSize(new java.awt.Dimension(100, 23));
        pnlFindBooksForPayBook.add(txtFindForPayBook);

        btnFindForPayBook.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnFindForPayBook.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\find.png")); // NOI18N
        btnFindForPayBook.setText("Find");
        btnFindForPayBook.setPreferredSize(new java.awt.Dimension(120, 31));
        btnFindForPayBook.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFindForPayBookActionPerformed(evt);
            }
        });
        pnlFindBooksForPayBook.add(btnFindForPayBook);

        pnlPayBook.add(pnlFindBooksForPayBook, java.awt.BorderLayout.PAGE_START);

        pnlResultForPayBook.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlResultForPayBook.setLayout(new java.awt.BorderLayout());

        pnlResultFindForPayBook.setPreferredSize(new java.awt.Dimension(400, 341));
        pnlResultFindForPayBook.setLayout(new java.awt.BorderLayout());

        jPanel6.setPreferredSize(new java.awt.Dimension(400, 110));

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel6.setText("Employee ID:");

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel9.setText("Employee Name:");

        txtEmployeeIDForPayBookByOrdersID.setFont(new java.awt.Font("Tahoma", 0, 12));

        txtEmployeeNameForPayBookByOrdersID.setFont(new java.awt.Font("Tahoma", 0, 12));

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtEmployeeNameForPayBookByOrdersID, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtEmployeeIDForPayBookByOrdersID, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(59, 59, 59))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmployeeIDForPayBookByOrdersID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(28, 28, 28)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmployeeNameForPayBookByOrdersID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addContainerGap(21, Short.MAX_VALUE))
        );

        pnlResultFindForPayBook.add(jPanel6, java.awt.BorderLayout.PAGE_START);

        jPanel7.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jPanel7.setPreferredSize(new java.awt.Dimension(400, 35));
        jPanel7.setLayout(new java.awt.GridBagLayout());

        btnSelectBookToPay.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnSelectBookToPay.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\add-to-pay.png")); // NOI18N
        btnSelectBookToPay.setText("Select book to pay");
        btnSelectBookToPay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSelectBookToPayActionPerformed(evt);
            }
        });
        jPanel7.add(btnSelectBookToPay, new java.awt.GridBagConstraints());

        pnlResultFindForPayBook.add(jPanel7, java.awt.BorderLayout.PAGE_END);

        jPanel8.setLayout(new java.awt.BorderLayout());

        tblBooksInOrders.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane3.setViewportView(tblBooksInOrders);

        jPanel8.add(jScrollPane3, java.awt.BorderLayout.CENTER);

        pnlResultFindForPayBook.add(jPanel8, java.awt.BorderLayout.CENTER);

        pnlResultForPayBook.add(pnlResultFindForPayBook, java.awt.BorderLayout.LINE_START);

        pnlCertificationForPayBook.setLayout(new java.awt.BorderLayout());

        jPanel16.setPreferredSize(new java.awt.Dimension(314, 260));
        jPanel16.setLayout(new java.awt.BorderLayout());

        tblBooksToPay.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane4.setViewportView(tblBooksToPay);

        jPanel16.add(jScrollPane4, java.awt.BorderLayout.CENTER);

        pnlCertificationForPayBook.add(jPanel16, java.awt.BorderLayout.PAGE_START);

        jPanel17.setPreferredSize(new java.awt.Dimension(314, 35));
        jPanel17.setLayout(new java.awt.GridBagLayout());

        btnSavePayBook.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnSavePayBook.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\payment.png")); // NOI18N
        btnSavePayBook.setText("Save");
        btnSavePayBook.setPreferredSize(new java.awt.Dimension(130, 33));
        btnSavePayBook.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSavePayBookActionPerformed(evt);
            }
        });
        jPanel17.add(btnSavePayBook, new java.awt.GridBagConstraints());

        pnlCertificationForPayBook.add(jPanel17, java.awt.BorderLayout.PAGE_END);

        jPanel18.setPreferredSize(new java.awt.Dimension(314, 80));
        jPanel18.setLayout(new java.awt.BorderLayout());

        jPanel19.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel19.setPreferredSize(new java.awt.Dimension(314, 85));

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel10.setText("Amount:");

        txtAmount.setFont(new java.awt.Font("Tahoma", 0, 12));

        javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19);
        jPanel19.setLayout(jPanel19Layout);
        jPanel19Layout.setHorizontalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel19Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel10)
                .addGap(43, 43, 43)
                .addComponent(txtAmount, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel19Layout.setVerticalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel19Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addContainerGap(35, Short.MAX_VALUE))
        );

        jPanel18.add(jPanel19, java.awt.BorderLayout.PAGE_END);

        jPanel20.setPreferredSize(new java.awt.Dimension(314, 35));
        jPanel20.setLayout(new java.awt.GridBagLayout());

        btnPutBackOrders.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnPutBackOrders.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Noi\\Desktop\\fat1-c1101i-s2-g2\\source code\\LibraryManagementSystem\\icons\\put-back-orders.png")); // NOI18N
        btnPutBackOrders.setText("Put back orders");
        btnPutBackOrders.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPutBackOrdersActionPerformed(evt);
            }
        });
        jPanel20.add(btnPutBackOrders, new java.awt.GridBagConstraints());

        jPanel18.add(jPanel20, java.awt.BorderLayout.CENTER);

        pnlCertificationForPayBook.add(jPanel18, java.awt.BorderLayout.CENTER);

        pnlResultForPayBook.add(pnlCertificationForPayBook, java.awt.BorderLayout.CENTER);

        pnlPayBook.add(pnlResultForPayBook, java.awt.BorderLayout.CENTER);

        pnlCenter.add(pnlPayBook, "card3");

        javax.swing.GroupLayout pnlEmployeeManagerLayout = new javax.swing.GroupLayout(pnlEmployeeManager);
        pnlEmployeeManager.setLayout(pnlEmployeeManagerLayout);
        pnlEmployeeManagerLayout.setHorizontalGroup(
            pnlEmployeeManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 758, Short.MAX_VALUE)
        );
        pnlEmployeeManagerLayout.setVerticalGroup(
            pnlEmployeeManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 471, Short.MAX_VALUE)
        );

        pnlCenter.add(pnlEmployeeManager, "card6");

        javax.swing.GroupLayout pnlBookManagerLayout = new javax.swing.GroupLayout(pnlBookManager);
        pnlBookManager.setLayout(pnlBookManagerLayout);
        pnlBookManagerLayout.setHorizontalGroup(
            pnlBookManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 758, Short.MAX_VALUE)
        );
        pnlBookManagerLayout.setVerticalGroup(
            pnlBookManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 471, Short.MAX_VALUE)
        );

        pnlCenter.add(pnlBookManager, "card7");

        pnlStatistic.setLayout(new java.awt.BorderLayout());

        pnlHeaderStatistic.setPreferredSize(new java.awt.Dimension(722, 50));
        pnlHeaderStatistic.setLayout(new javax.swing.BoxLayout(pnlHeaderStatistic, javax.swing.BoxLayout.LINE_AXIS));

        pnlStatisticHistoryBooks.setBackground(new java.awt.Color(153, 153, 153));
        pnlStatisticHistoryBooks.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlStatisticHistoryBooks.setForeground(new java.awt.Color(0, 255, 204));
        pnlStatisticHistoryBooks.setName("pnlStatisticHistoryBooks"); // NOI18N
        pnlStatisticHistoryBooks.setLayout(new java.awt.BorderLayout());

        lblHistoryBooks.setFont(new java.awt.Font("Tahoma", 1, 14));
        lblHistoryBooks.setForeground(new java.awt.Color(255, 255, 255));
        lblHistoryBooks.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblHistoryBooks.setText("History Books");
        lblHistoryBooks.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblHistoryBooksMouseClicked(evt);
            }
        });
        pnlStatisticHistoryBooks.add(lblHistoryBooks, java.awt.BorderLayout.CENTER);

        pnlHeaderStatistic.add(pnlStatisticHistoryBooks);

        pnlStatisticHistoryEmployee.setBackground(new java.awt.Color(153, 153, 153));
        pnlStatisticHistoryEmployee.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlStatisticHistoryEmployee.setName("pnlStatisticHistoryEmployee"); // NOI18N
        pnlStatisticHistoryEmployee.setLayout(new java.awt.BorderLayout());

        lblHistoryEmployee.setFont(new java.awt.Font("Tahoma", 1, 14));
        lblHistoryEmployee.setForeground(new java.awt.Color(255, 255, 255));
        lblHistoryEmployee.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblHistoryEmployee.setText("History Employee");
        lblHistoryEmployee.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblHistoryEmployeeMouseClicked(evt);
            }
        });
        pnlStatisticHistoryEmployee.add(lblHistoryEmployee, java.awt.BorderLayout.CENTER);

        pnlHeaderStatistic.add(pnlStatisticHistoryEmployee);

        pnlStatisticMostBorrowedBook.setBackground(new java.awt.Color(153, 153, 153));
        pnlStatisticMostBorrowedBook.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlStatisticMostBorrowedBook.setName("pnlStatisticMostBorrowedBook"); // NOI18N
        pnlStatisticMostBorrowedBook.setLayout(new java.awt.BorderLayout());

        lblMostBorrowedBook.setFont(new java.awt.Font("Tahoma", 1, 14));
        lblMostBorrowedBook.setForeground(new java.awt.Color(255, 255, 255));
        lblMostBorrowedBook.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblMostBorrowedBook.setText("Most Borrowed Book");
        lblMostBorrowedBook.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblMostBorrowedBookMouseClicked(evt);
            }
        });
        pnlStatisticMostBorrowedBook.add(lblMostBorrowedBook, java.awt.BorderLayout.CENTER);

        pnlHeaderStatistic.add(pnlStatisticMostBorrowedBook);

        pnlEmployeesBorrowedMost.setBackground(new java.awt.Color(153, 153, 153));
        pnlEmployeesBorrowedMost.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlEmployeesBorrowedMost.setName("pnlEmployeeBorrowedMost"); // NOI18N
        pnlEmployeesBorrowedMost.setLayout(new java.awt.BorderLayout());

        lblEmployeeBorrowedMost.setFont(new java.awt.Font("Tahoma", 1, 14));
        lblEmployeeBorrowedMost.setForeground(new java.awt.Color(255, 255, 255));
        lblEmployeeBorrowedMost.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblEmployeeBorrowedMost.setText("History Borrow and Pay Books");
        lblEmployeeBorrowedMost.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblEmployeeBorrowedMostMouseClicked(evt);
            }
        });
        pnlEmployeesBorrowedMost.add(lblEmployeeBorrowedMost, java.awt.BorderLayout.CENTER);

        pnlHeaderStatistic.add(pnlEmployeesBorrowedMost);

        pnlBorrowBooksOverDue.setBackground(new java.awt.Color(153, 153, 153));
        pnlBorrowBooksOverDue.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlBorrowBooksOverDue.setName("pnlBorrowBooksOverDue"); // NOI18N
        pnlBorrowBooksOverDue.setLayout(new java.awt.BorderLayout());

        lblBorrowBooksOverDue.setFont(new java.awt.Font("Tahoma", 1, 14));
        lblBorrowBooksOverDue.setForeground(new java.awt.Color(255, 255, 255));
        lblBorrowBooksOverDue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblBorrowBooksOverDue.setText("Fines");
        lblBorrowBooksOverDue.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblBorrowBooksOverDueMouseClicked(evt);
            }
        });
        pnlBorrowBooksOverDue.add(lblBorrowBooksOverDue, java.awt.BorderLayout.CENTER);

        pnlHeaderStatistic.add(pnlBorrowBooksOverDue);

        pnlStatistic.add(pnlHeaderStatistic, java.awt.BorderLayout.PAGE_START);

        pnlStatisticCenter.setLayout(new java.awt.CardLayout());

        pnlHistoryBooks.setLayout(new java.awt.BorderLayout());

        jPanel23.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel23.setPreferredSize(new java.awt.Dimension(722, 40));
        jPanel23.setLayout(new java.awt.BorderLayout());

        jPanel29.setPreferredSize(new java.awt.Dimension(400, 40));

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel12.setText("Enter:");
        jLabel12.setPreferredSize(new java.awt.Dimension(60, 20));
        jPanel29.add(jLabel12);

        txtFindHistoryBook.setFont(new java.awt.Font("Tahoma", 1, 12));
        txtFindHistoryBook.setPreferredSize(new java.awt.Dimension(120, 22));
        jPanel29.add(txtFindHistoryBook);

        btnFindHistoryBook.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnFindHistoryBook.setText("Find");
        btnFindHistoryBook.setPreferredSize(new java.awt.Dimension(100, 23));
        btnFindHistoryBook.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFindHistoryBookActionPerformed(evt);
            }
        });
        jPanel29.add(btnFindHistoryBook);

        jPanel23.add(jPanel29, java.awt.BorderLayout.LINE_END);

        jPanel30.setPreferredSize(new java.awt.Dimension(300, 40));

        buttonGroupFindBookForHistoryBook.add(rdBookIDForHistoryBook);
        rdBookIDForHistoryBook.setFont(new java.awt.Font("Tahoma", 1, 12));
        rdBookIDForHistoryBook.setSelected(true);
        rdBookIDForHistoryBook.setText("Book ID");
        rdBookIDForHistoryBook.setPreferredSize(new java.awt.Dimension(120, 23));
        jPanel30.add(rdBookIDForHistoryBook);

        buttonGroupFindBookForHistoryBook.add(rdBookTitleForHistoryBook);
        rdBookTitleForHistoryBook.setFont(new java.awt.Font("Tahoma", 1, 12));
        rdBookTitleForHistoryBook.setText("Book Name");
        rdBookTitleForHistoryBook.setPreferredSize(new java.awt.Dimension(120, 23));
        jPanel30.add(rdBookTitleForHistoryBook);

        jPanel23.add(jPanel30, java.awt.BorderLayout.CENTER);

        pnlHistoryBooks.add(jPanel23, java.awt.BorderLayout.PAGE_START);

        jPanel24.setLayout(new java.awt.BorderLayout());

        jPanel31.setPreferredSize(new java.awt.Dimension(758, 50));

        javax.swing.GroupLayout jPanel31Layout = new javax.swing.GroupLayout(jPanel31);
        jPanel31.setLayout(jPanel31Layout);
        jPanel31Layout.setHorizontalGroup(
            jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 758, Short.MAX_VALUE)
        );
        jPanel31Layout.setVerticalGroup(
            jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 50, Short.MAX_VALUE)
        );

        jPanel24.add(jPanel31, java.awt.BorderLayout.PAGE_END);

        jPanel32.setLayout(new java.awt.BorderLayout());

        lblBookIDForHistoryBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblBookIDForHistoryBook.setText("Book ID:");

        lblBookNameForHistoryBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblBookNameForHistoryBook.setText("Book Name:");

        txtBookNameForHistoryBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        txtBookNameForHistoryBook.setPreferredSize(new java.awt.Dimension(6, 23));

        cbbBookIDForHistoryBook.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbbBookIDForHistoryBook.setPreferredSize(new java.awt.Dimension(56, 23));
        cbbBookIDForHistoryBook.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbbBookIDForHistoryBookItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout jPanel25Layout = new javax.swing.GroupLayout(jPanel25);
        jPanel25.setLayout(jPanel25Layout);
        jPanel25Layout.setHorizontalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblBookIDForHistoryBook)
                    .addComponent(lblBookNameForHistoryBook))
                .addGap(39, 39, 39)
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cbbBookIDForHistoryBook, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtBookNameForHistoryBook, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE))
                .addContainerGap(382, Short.MAX_VALUE))
        );
        jPanel25Layout.setVerticalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblBookIDForHistoryBook)
                    .addComponent(cbbBookIDForHistoryBook, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblBookNameForHistoryBook)
                    .addComponent(txtBookNameForHistoryBook, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22))
        );

        jPanel32.add(jPanel25, java.awt.BorderLayout.PAGE_START);

        jPanel26.setLayout(new java.awt.BorderLayout());

        tblHistoryBook.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane5.setViewportView(tblHistoryBook);

        jPanel26.add(jScrollPane5, java.awt.BorderLayout.CENTER);

        jPanel32.add(jPanel26, java.awt.BorderLayout.CENTER);

        jPanel24.add(jPanel32, java.awt.BorderLayout.CENTER);

        pnlHistoryBooks.add(jPanel24, java.awt.BorderLayout.CENTER);

        pnlStatisticCenter.add(pnlHistoryBooks, "card3");

        pnlHistoryEmployee.setLayout(new java.awt.BorderLayout());

        jPanel27.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel27.setPreferredSize(new java.awt.Dimension(758, 40));
        jPanel27.setLayout(new java.awt.BorderLayout());

        jPanel34.setPreferredSize(new java.awt.Dimension(350, 40));
        jPanel27.add(jPanel34, java.awt.BorderLayout.LINE_START);

        lblFindEmployeeForHistoryEmployee.setFont(new java.awt.Font("Tahoma", 1, 12));
        lblFindEmployeeForHistoryEmployee.setText("Enter Employee:");
        lblFindEmployeeForHistoryEmployee.setPreferredSize(new java.awt.Dimension(120, 20));
        jPanel35.add(lblFindEmployeeForHistoryEmployee);

        txtFindHistoryEmployee.setFont(new java.awt.Font("Tahoma", 1, 12));
        txtFindHistoryEmployee.setPreferredSize(new java.awt.Dimension(140, 22));
        jPanel35.add(txtFindHistoryEmployee);

        btnFindHistoryEmployee.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnFindHistoryEmployee.setText("Find");
        btnFindHistoryEmployee.setPreferredSize(new java.awt.Dimension(100, 23));
        btnFindHistoryEmployee.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFindHistoryEmployeeActionPerformed(evt);
            }
        });
        jPanel35.add(btnFindHistoryEmployee);

        jPanel27.add(jPanel35, java.awt.BorderLayout.CENTER);

        pnlHistoryEmployee.add(jPanel27, java.awt.BorderLayout.PAGE_START);

        jPanel28.setPreferredSize(new java.awt.Dimension(758, 140));
        jPanel28.setLayout(new java.awt.BorderLayout());

        tblOrdersDetailsForHistoryEmployee.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane7.setViewportView(tblOrdersDetailsForHistoryEmployee);

        jPanel28.add(jScrollPane7, java.awt.BorderLayout.CENTER);

        pnlHistoryEmployee.add(jPanel28, java.awt.BorderLayout.PAGE_END);

        jPanel33.setLayout(new java.awt.BorderLayout());

        lblEmployeeIDForHistoryEmployee.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblEmployeeIDForHistoryEmployee.setText("Employee ID:");

        lblEmployeeNameForHistoryEmployee.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblEmployeeNameForHistoryEmployee.setText("Employee Name:");

        txtEmployeeNameForHistoryEmployee.setFont(new java.awt.Font("Tahoma", 0, 12));
        txtEmployeeNameForHistoryEmployee.setPreferredSize(new java.awt.Dimension(6, 23));

        cbbEmployeeIDForHistoryEmployee.setFont(new java.awt.Font("Tahoma", 0, 12));
        cbbEmployeeIDForHistoryEmployee.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbbEmployeeIDForHistoryEmployee.setMinimumSize(new java.awt.Dimension(63, 23));
        cbbEmployeeIDForHistoryEmployee.setPreferredSize(new java.awt.Dimension(63, 23));
        cbbEmployeeIDForHistoryEmployee.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbbEmployeeIDForHistoryEmployeeItemStateChanged(evt);
            }
        });

        txtDepartmentForHistoryEmployee.setFont(new java.awt.Font("Tahoma", 0, 12));
        txtDepartmentForHistoryEmployee.setPreferredSize(new java.awt.Dimension(6, 23));

        lblDepartmentForHistoryEmployee.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblDepartmentForHistoryEmployee.setText("Department:");

        javax.swing.GroupLayout jPanel36Layout = new javax.swing.GroupLayout(jPanel36);
        jPanel36.setLayout(jPanel36Layout);
        jPanel36Layout.setHorizontalGroup(
            jPanel36Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel36Layout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addComponent(lblEmployeeIDForHistoryEmployee)
                .addGap(28, 28, 28)
                .addComponent(cbbEmployeeIDForHistoryEmployee, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(105, 105, 105)
                .addGroup(jPanel36Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDepartmentForHistoryEmployee)
                    .addComponent(lblEmployeeNameForHistoryEmployee))
                .addGap(27, 27, 27)
                .addGroup(jPanel36Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtDepartmentForHistoryEmployee, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtEmployeeNameForHistoryEmployee, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE))
                .addGap(44, 44, 44))
        );
        jPanel36Layout.setVerticalGroup(
            jPanel36Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel36Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel36Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cbbEmployeeIDForHistoryEmployee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblEmployeeIDForHistoryEmployee)
                    .addGroup(jPanel36Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtEmployeeNameForHistoryEmployee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblEmployeeNameForHistoryEmployee)))
                .addGap(18, 18, 18)
                .addGroup(jPanel36Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblDepartmentForHistoryEmployee)
                    .addComponent(txtDepartmentForHistoryEmployee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel33.add(jPanel36, java.awt.BorderLayout.PAGE_START);

        jPanel37.setLayout(new java.awt.BorderLayout());

        tblHistoryEmployeeForEmployee.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblHistoryEmployeeForEmployee.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblHistoryEmployeeForEmployeeMouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(tblHistoryEmployeeForEmployee);

        jPanel37.add(jScrollPane6, java.awt.BorderLayout.CENTER);

        jPanel33.add(jPanel37, java.awt.BorderLayout.CENTER);

        pnlHistoryEmployee.add(jPanel33, java.awt.BorderLayout.CENTER);

        pnlStatisticCenter.add(pnlHistoryEmployee, "card3");

        pnlMostBorrowedBook.setLayout(new java.awt.BorderLayout());

        jPanel38.setPreferredSize(new java.awt.Dimension(778, 25));
        jPanel38.setLayout(new java.awt.BorderLayout());

        jPanel41.setPreferredSize(new java.awt.Dimension(200, 35));
        jPanel41.setLayout(new java.awt.BorderLayout());

        cbbCategoryForMostBorrowedBook.setFont(new java.awt.Font("Tahoma", 0, 12));
        cbbCategoryForMostBorrowedBook.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbbCategoryForMostBorrowedBook.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbbCategoryForMostBorrowedBookItemStateChanged(evt);
            }
        });
        jPanel41.add(cbbCategoryForMostBorrowedBook, java.awt.BorderLayout.CENTER);

        jPanel38.add(jPanel41, java.awt.BorderLayout.LINE_END);

        pnlMostBorrowedBook.add(jPanel38, java.awt.BorderLayout.PAGE_START);

        jPanel39.setPreferredSize(new java.awt.Dimension(778, 180));
        jPanel39.setLayout(new java.awt.BorderLayout());

        tblOrdersDetailsForMostBorrowedBook.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane9.setViewportView(tblOrdersDetailsForMostBorrowedBook);

        jPanel39.add(jScrollPane9, java.awt.BorderLayout.CENTER);

        pnlMostBorrowedBook.add(jPanel39, java.awt.BorderLayout.PAGE_END);

        jPanel40.setLayout(new java.awt.BorderLayout());

        tblMostBorrowedBook.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblMostBorrowedBook.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblMostBorrowedBookMouseClicked(evt);
            }
        });
        jScrollPane8.setViewportView(tblMostBorrowedBook);

        jPanel40.add(jScrollPane8, java.awt.BorderLayout.CENTER);

        pnlMostBorrowedBook.add(jPanel40, java.awt.BorderLayout.CENTER);

        pnlStatisticCenter.add(pnlMostBorrowedBook, "card4");

        pnlEmployeeBorrowBooks.setLayout(new java.awt.BorderLayout());

        jPanel42.setPreferredSize(new java.awt.Dimension(758, 25));
        jPanel42.setLayout(new java.awt.BorderLayout());

        jPanel45.setPreferredSize(new java.awt.Dimension(200, 30));
        jPanel45.setLayout(new java.awt.BorderLayout());

        cbbDepartmentForEmloyeeBorrowBooks.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbbDepartmentForEmloyeeBorrowBooks.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbbDepartmentForEmloyeeBorrowBooksItemStateChanged(evt);
            }
        });
        jPanel45.add(cbbDepartmentForEmloyeeBorrowBooks, java.awt.BorderLayout.CENTER);

        jPanel42.add(jPanel45, java.awt.BorderLayout.LINE_END);

        pnlEmployeeBorrowBooks.add(jPanel42, java.awt.BorderLayout.PAGE_START);

        jPanel43.setPreferredSize(new java.awt.Dimension(758, 180));
        jPanel43.setLayout(new java.awt.BorderLayout());

        jScrollPane11.setPreferredSize(new java.awt.Dimension(452, 180));

        tblDetailsBorrowBooksOfEmployee.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane11.setViewportView(tblDetailsBorrowBooksOfEmployee);

        jPanel43.add(jScrollPane11, java.awt.BorderLayout.CENTER);

        pnlEmployeeBorrowBooks.add(jPanel43, java.awt.BorderLayout.PAGE_END);

        jPanel44.setLayout(new java.awt.BorderLayout());

        jPanel46.setPreferredSize(new java.awt.Dimension(758, 30));
        jPanel46.setLayout(new java.awt.BorderLayout());

        jPanel48.setPreferredSize(new java.awt.Dimension(400, 30));

        lblNumberOfBooksBorrowed.setFont(new java.awt.Font("Tahoma", 1, 12));
        lblNumberOfBooksBorrowed.setText("Number of books borrowed:");
        lblNumberOfBooksBorrowed.setPreferredSize(new java.awt.Dimension(190, 15));
        jPanel48.add(lblNumberOfBooksBorrowed);

        lblResultNumberOfBookBorrowed.setFont(new java.awt.Font("Tahoma", 1, 12));
        jPanel48.add(lblResultNumberOfBookBorrowed);

        jPanel46.add(jPanel48, java.awt.BorderLayout.LINE_START);

        lblOutstandingBooks.setFont(new java.awt.Font("Tahoma", 1, 12));
        lblOutstandingBooks.setText("Outstanding books:");
        lblOutstandingBooks.setPreferredSize(new java.awt.Dimension(140, 15));
        jPanel49.add(lblOutstandingBooks);

        lblResultOutstandingBooks.setFont(new java.awt.Font("Tahoma", 1, 12));
        jPanel49.add(lblResultOutstandingBooks);

        jPanel46.add(jPanel49, java.awt.BorderLayout.CENTER);

        jPanel44.add(jPanel46, java.awt.BorderLayout.PAGE_END);

        jPanel47.setLayout(new java.awt.BorderLayout());

        tblEmployeeForEmployeeBorrowBooks.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblEmployeeForEmployeeBorrowBooks.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblEmployeeForEmployeeBorrowBooksMouseClicked(evt);
            }
        });
        jScrollPane10.setViewportView(tblEmployeeForEmployeeBorrowBooks);

        jPanel47.add(jScrollPane10, java.awt.BorderLayout.CENTER);

        jPanel44.add(jPanel47, java.awt.BorderLayout.CENTER);

        pnlEmployeeBorrowBooks.add(jPanel44, java.awt.BorderLayout.CENTER);

        pnlStatisticCenter.add(pnlEmployeeBorrowBooks, "card5");

        pnlFines.setLayout(new java.awt.BorderLayout());

        jPanel50.setPreferredSize(new java.awt.Dimension(758, 25));
        jPanel50.setLayout(new java.awt.BorderLayout());

        jPanel53.setPreferredSize(new java.awt.Dimension(400, 30));
        jPanel53.setLayout(new java.awt.BorderLayout());

        lblEmployeeNameForFines.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblEmployeeNameForFines.setText("Employee Name:");
        lblEmployeeNameForFines.setPreferredSize(new java.awt.Dimension(120, 14));
        jPanel53.add(lblEmployeeNameForFines, java.awt.BorderLayout.LINE_START);

        txtEmployeeNameForFines.setFont(new java.awt.Font("Tahoma", 0, 12));
        jPanel53.add(txtEmployeeNameForFines, java.awt.BorderLayout.CENTER);

        btnFindEmployeeForFines.setFont(new java.awt.Font("Tahoma", 1, 12));
        btnFindEmployeeForFines.setText("Find");
        btnFindEmployeeForFines.setPreferredSize(new java.awt.Dimension(110, 23));
        btnFindEmployeeForFines.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFindEmployeeForFinesActionPerformed(evt);
            }
        });
        jPanel53.add(btnFindEmployeeForFines, java.awt.BorderLayout.LINE_END);

        jPanel50.add(jPanel53, java.awt.BorderLayout.LINE_END);

        pnlFines.add(jPanel50, java.awt.BorderLayout.PAGE_START);

        jPanel51.setPreferredSize(new java.awt.Dimension(758, 200));
        jPanel51.setLayout(new java.awt.BorderLayout());

        tblDetailsEmployeePayAFine.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane13.setViewportView(tblDetailsEmployeePayAFine);

        jPanel51.add(jScrollPane13, java.awt.BorderLayout.CENTER);

        pnlFines.add(jPanel51, java.awt.BorderLayout.PAGE_END);

        jPanel52.setLayout(new java.awt.BorderLayout());

        tblEmployeesPayAFine.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblEmployeesPayAFine.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblEmployeesPayAFineMouseClicked(evt);
            }
        });
        jScrollPane12.setViewportView(tblEmployeesPayAFine);

        jPanel52.add(jScrollPane12, java.awt.BorderLayout.CENTER);

        pnlFines.add(jPanel52, java.awt.BorderLayout.CENTER);

        pnlStatisticCenter.add(pnlFines, "card6");

        pnlStatistic.add(pnlStatisticCenter, java.awt.BorderLayout.CENTER);

        pnlCenter.add(pnlStatistic, "card8");

        jPanel5.add(pnlCenter, java.awt.BorderLayout.CENTER);

        jPanel2.add(jPanel5, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void cbbDepartmentForBorrowBookItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbbDepartmentForBorrowBookItemStateChanged
        Department department = (Department) this.cbbDepartmentForBorrowBook.getSelectedItem();
        if (department != null) {
            this.loadToEmployeeComboBoxModelByDepartmentSelected(department);
        }
}//GEN-LAST:event_cbbDepartmentForBorrowBookItemStateChanged

private void cbbEmployeeForBorrowBookItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbbEmployeeForBorrowBookItemStateChanged
    this.setTextFields((Employee) this.cbbEmployeeForBorrowBook.getSelectedItem());
}//GEN-LAST:event_cbbEmployeeForBorrowBookItemStateChanged

private void cbbCategoryForBorrowBookItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbbCategoryForBorrowBookItemStateChanged
    Category category = (Category) this.cbbCategoryForBorrowBook.getSelectedItem();
    if (category != null) {
        this.loadToBookListModel(category.getCategoryID());
    }
}//GEN-LAST:event_cbbCategoryForBorrowBookItemStateChanged
    
private void btnBorrowBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBorrowBookActionPerformed
        CardLayout layout = (CardLayout) this.pnlCenter.getLayout();
        layout.show(this.pnlCenter, "card2");
        this.lblFunction.setText("Borrow Book");
}//GEN-LAST:event_btnBorrowBookActionPerformed
    
private void btnPayBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPayBookActionPerformed
    CardLayout layout = (CardLayout) this.pnlCenter.getLayout();
    layout.show(this.pnlCenter, "card3");
    this.lblFunction.setText("Pay Book");
    this.initModelForPayBook();
}//GEN-LAST:event_btnPayBookActionPerformed
    
private void btnFindForPayBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFindForPayBookActionPerformed
        this.findBookForPayBook();
        this.payModel.clear();
}//GEN-LAST:event_btnFindForPayBookActionPerformed

private void btnSelectBookToPayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectBookToPayActionPerformed
        this.putToPayBook(this.tblBooksInOrders.getSelectedRow());
}//GEN-LAST:event_btnSelectBookToPayActionPerformed
    
private void btnPutBackOrdersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPutBackOrdersActionPerformed
    this.putBackOrders(this.tblBooksToPay.getSelectedRow());
}//GEN-LAST:event_btnPutBackOrdersActionPerformed

private void btnAddToCartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddToCartActionPerformed
    this.addToCart();
}//GEN-LAST:event_btnAddToCartActionPerformed
    
private void btnRemoveFromCartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveFromCartActionPerformed
        this.removeFromCart();
}//GEN-LAST:event_btnRemoveFromCartActionPerformed
    
private void btnFindEmployeeForFinesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFindEmployeeForFinesActionPerformed
        String employeeName = this.txtEmployeeNameForFines.getText().trim().toUpperCase();
        if (employeeName.length() == 0) {
            JOptionPane.showMessageDialog(this, "employee name is not blank");
        } else {
            ArrayList<Employee> alEmployees = this.manager.getEmployeeManager().getByEmployeeName(employeeName);
            if (alEmployees.isEmpty()) {
                JOptionPane.showMessageDialog(this, "no employee named " + employeeName);
            } else {
                this.employeeFineModel.setAlEmployees(alEmployees);
                this.employeePayModel.clear();
            }
        }
}//GEN-LAST:event_btnFindEmployeeForFinesActionPerformed

private void btnEmployeeManagerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEmployeeManagerActionPerformed
        CardLayout layout = (CardLayout) this.pnlCenter.getLayout();
        layout.show(this.pnlCenter, "card6");
        this.lblFunction.setText("Employee Manager");
}//GEN-LAST:event_btnEmployeeManagerActionPerformed
    
private void btnCreateOrdersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreateOrdersActionPerformed
        this.createOrders();
}//GEN-LAST:event_btnCreateOrdersActionPerformed

private void btnSavePayBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSavePayBookActionPerformed
    this.savePayBook();
}//GEN-LAST:event_btnSavePayBookActionPerformed
    
private void btnStatisticActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStatisticActionPerformed
    CardLayout layout = (CardLayout) this.pnlCenter.getLayout();
    layout.show(this.pnlCenter, "card8");
    this.lblFunction.setText("Statistic");
    if (bookForHistoryBookModel == null) {
        this.initJPanelHistoryBook();
    }
    this.setMenuSelectedStatistic(this.pnlStatisticHistoryBooks, this.lblHistoryBooks);
}//GEN-LAST:event_btnStatisticActionPerformed

private void lblHistoryBooksMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblHistoryBooksMouseClicked
    this.setMenuSelectedStatistic(this.pnlStatisticHistoryBooks, this.lblHistoryBooks);
    this.pnlHistoryBooks.setVisible(true);
    this.pnlHistoryEmployee.setVisible(false);
    this.pnlMostBorrowedBook.setVisible(false);
    this.pnlEmployeeBorrowBooks.setVisible(false);
    this.pnlFines.setVisible(false);
}//GEN-LAST:event_lblHistoryBooksMouseClicked
    
private void btnFindHistoryBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFindHistoryBookActionPerformed
        String textFind = this.txtFindHistoryBook.getText().trim().toUpperCase();
        if (textFind.length() == 0) {
            JOptionPane.showMessageDialog(this, "Enter your search information");
        } else {
            this.findHistoryBook(textFind);
        }
}//GEN-LAST:event_btnFindHistoryBookActionPerformed

private void lblHistoryEmployeeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblHistoryEmployeeMouseClicked
        this.lblHistoryEmployee();
}//GEN-LAST:event_lblHistoryEmployeeMouseClicked
    
private void lblMostBorrowedBookMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblMostBorrowedBookMouseClicked
        this.lblMostBorrowedBook();
}//GEN-LAST:event_lblMostBorrowedBookMouseClicked
    
private void lblEmployeeBorrowedMostMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblEmployeeBorrowedMostMouseClicked
    this.setMenuSelectedStatistic(this.pnlEmployeesBorrowedMost, this.lblEmployeeBorrowedMost);
    this.pnlHistoryBooks.setVisible(false);
    this.pnlHistoryEmployee.setVisible(false);
    this.pnlMostBorrowedBook.setVisible(false);
    this.pnlEmployeeBorrowBooks.setVisible(true);
    this.pnlFines.setVisible(false);
    
    this.lblEmployeeBorrowedBook();
}//GEN-LAST:event_lblEmployeeBorrowedMostMouseClicked
    
private void lblBorrowBooksOverDueMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblBorrowBooksOverDueMouseClicked
    this.setMenuSelectedStatistic(this.pnlBorrowBooksOverDue, this.lblBorrowBooksOverDue);
    this.pnlHistoryBooks.setVisible(false);
    this.pnlHistoryEmployee.setVisible(false);
    this.pnlMostBorrowedBook.setVisible(false);
    this.pnlEmployeeBorrowBooks.setVisible(false);
    this.pnlFines.setVisible(true);

    this.lblEmployeesFines();
}//GEN-LAST:event_lblBorrowBooksOverDueMouseClicked
    
private void btnFindHistoryEmployeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFindHistoryEmployeeActionPerformed
        this.findHistoryEmployee();
}//GEN-LAST:event_btnFindHistoryEmployeeActionPerformed
    
private void tblHistoryEmployeeForEmployeeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblHistoryEmployeeForEmployeeMouseClicked
        int selected = this.tblHistoryEmployeeForEmployee.getSelectedRow();
        if (selected >= 0) {
            Orders orders = (Orders) this.historyEmployeeModel.get(selected);
            ArrayList<OrdersDetails> alDetails = this.manager.getOrdersDetailsManager().getByOrdersID(orders.getOrdersID());
            this.orderForHistoryEmployeeModel.setAlDetails(alDetails);
        }
}//GEN-LAST:event_tblHistoryEmployeeForEmployeeMouseClicked
    
private void tblMostBorrowedBookMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblMostBorrowedBookMouseClicked
    int selected = this.tblMostBorrowedBook.getSelectedRow();
    if (selected >= 0) {
        Book book = (Book) this.mostBorrowedBookModel.get(selected);
        ArrayList<Book> alBook = this.manager.getBookManager().getByBookName(book.getTitle());
        this.ordersForMostBorrowedBookModel.setAlDetails(this.manager.getOrdersDetailsManager().getByBookID(alBook));
    }
}//GEN-LAST:event_tblMostBorrowedBookMouseClicked
    
private void cbbCategoryForMostBorrowedBookItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbbCategoryForMostBorrowedBookItemStateChanged
        int selected = this.cbbCategoryForMostBorrowedBook.getSelectedIndex();
        if (selected > 0) {
            Category category = (Category) this.cbbCategoryForMostBorrowedBook.getSelectedItem();
            ArrayList<Book> alBook = this.manager.getBookManager().getByCategoryID(category);
            this.mostBorrowedBookModel.setAlBook(alBook);
        }
}//GEN-LAST:event_cbbCategoryForMostBorrowedBookItemStateChanged

private void cbbDepartmentForEmloyeeBorrowBooksItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbbDepartmentForEmloyeeBorrowBooksItemStateChanged
    if (this.cbbDepartmentForEmloyeeBorrowBooks.getSelectedIndex() > 0) {
        Department department = (Department) this.cbbDepartmentForEmloyeeBorrowBooks.getSelectedItem();
        ArrayList<Employee> alEmployees = this.manager.getEmployeeManager().getByDepartmentID(department.getDepartmentID());
        this.employeeBorrowBooksModel.setAlEmployee(alEmployees);
    } else {
        this.employeeBorrowBooksModel.setAlEmployee(this.manager.getEmployeeManager().getEmployeeList());
    }
    this.setCountBorrowedBooks();

    this.detailsEmployeeBorrowBookModel.clear();
}//GEN-LAST:event_cbbDepartmentForEmloyeeBorrowBooksItemStateChanged
    
private void tblEmployeeForEmployeeBorrowBooksMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblEmployeeForEmployeeBorrowBooksMouseClicked
        Employee employee = this.employeeBorrowBooksModel.get(this.tblEmployeeForEmployeeBorrowBooks.getSelectedRow());
        if (employee != null) {
            ArrayList<Orders> alOrders = this.manager.getOrdersManager().getByEmployeeID(employee.getEmployeeID());
            ArrayList<OrdersDetails> alDetails = this.manager.getOrdersDetailsManager().getListOrdersDetailsByOrdersList(alOrders);
            this.detailsEmployeeBorrowBookModel.setAlDetails(alDetails);
        }
}//GEN-LAST:event_tblEmployeeForEmployeeBorrowBooksMouseClicked
    
private void tblEmployeesPayAFineMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblEmployeesPayAFineMouseClicked
    Employee employee = this.employeeFineModel.get(this.tblEmployeesPayAFine.getSelectedRow());
    if(employee != null) {
        ArrayList<Orders> alOrders = this.manager.getOrdersManager().getByEmployeeID(employee.getEmployeeID());
        ArrayList<OrdersDetails> alDetails = this.manager.getOrdersDetailsManager().getListOrdersDetailsPaid(alOrders);
        this.employeePayModel.setAlDetails(alDetails);
    }
}//GEN-LAST:event_tblEmployeesPayAFineMouseClicked
    
private void cbbEmployeeIDForHistoryEmployeeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbbEmployeeIDForHistoryEmployeeItemStateChanged
    int employeeID = Integer.valueOf(this.cbbEmployeeIDForHistoryEmployee.getSelectedItem().toString());
    if(employeeID > 0) {
        Employee employee = this.manager.getEmployeeManager().getByEmployeeID(employeeID);
        this.txtEmployeeNameForHistoryEmployee.setText(employee.getEmployeeName());
        this.txtDepartmentForHistoryEmployee.setText(this.manager.getDepartmentManager().getByID(employee.getDepartmentID()).getDepartmentName());
        this.historyEmployeeModel.setEmployee(employee);
    }
}//GEN-LAST:event_cbbEmployeeIDForHistoryEmployeeItemStateChanged

private void cbbBookIDForHistoryBookItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbbBookIDForHistoryBookItemStateChanged
    int selected = this.cbbBookIDForHistoryBook.getSelectedIndex();
    ArrayList<OrdersDetails> alDetails = null;
    if(selected > 0) {
        int bookID = Integer.valueOf(this.cbbBookIDForHistoryBook.getSelectedItem().toString());
        alDetails = this.manager.getOrdersDetailsManager().getByBookID(this.manager.getBookManager().getByBookID(bookID));
    } else if(selected == 0){
        String bookName = this.txtBookNameForHistoryBook.getText().trim().toUpperCase();
        ArrayList<Book> alBook = this.manager.getBookManager().getByBookName(bookName);
        alDetails = this.manager.getOrdersDetailsManager().getByBookID(alBook);
    }
    this.historyBookModel.setAlOrdersDetailses(alDetails);
}//GEN-LAST:event_cbbBookIDForHistoryBookItemStateChanged

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(JFrame_Library.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(JFrame_Library.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(JFrame_Library.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(JFrame_Library.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                new JFrame_Library().setVisible(true);
            }
        });
    }
    private DetailsEmployeePayAFineTableModel employeePayModel;
    private EmployeeFineTableModel employeeFineModel;
    private DetailsEmployeeBorrowBooksTableModel detailsEmployeeBorrowBookModel;
    private EmployeeBorrowBooksTableModel employeeBorrowBooksModel;
    private MostBorrowedBookTableModel mostBorrowedBookModel;
    private OrdersDetailsByBookIDTableModel ordersForMostBorrowedBookModel;
    private OrderDetailsByOrdersIDTableModel orderForHistoryEmployeeModel;
    private HistoryEmployeeTableModel historyEmployeeModel;
    private HistoryBookTableModel historyBookModel;
    private BookToPayTableModel payModel;
    private BookInOrdersTableModel ordersModel;
    private DefaultComboBoxModel<Employee> employeeOfDepartmentModel;
    private DefaultComboBoxModel<Department> departmentModel;
    private DefaultComboBoxModel employeeForHistoryEmployeeModel;
    private DefaultComboBoxModel categoryModel, categoryForMostBorrowedBookModel, departmentForEmployeeBorrowedMostModel;
    private DefaultListModel<Book> listBookForCategoryModel;
    private DefaultListModel<Book> listBookCartModel;
    private manager.Manager manager;
    private DefaultComboBoxModel bookForHistoryBookModel;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAddToCart;
    private javax.swing.JButton btnBookManager;
    private javax.swing.JButton btnBorrowBook;
    private javax.swing.JButton btnCreateOrders;
    private javax.swing.JButton btnEmployeeManager;
    private javax.swing.JButton btnFindEmployeeForFines;
    private javax.swing.JButton btnFindForPayBook;
    private javax.swing.JButton btnFindHistoryBook;
    private javax.swing.JButton btnFindHistoryEmployee;
    private javax.swing.JButton btnPayBook;
    private javax.swing.JButton btnPutBackOrders;
    private javax.swing.JButton btnRemoveFromCart;
    private javax.swing.JButton btnSavePayBook;
    private javax.swing.JButton btnSelectBookToPay;
    private javax.swing.JButton btnStatistic;
    private javax.swing.JButton btnUserManager;
    private javax.swing.ButtonGroup buttonGroupFindBookForHistoryBook;
    private javax.swing.ButtonGroup buttonGroupFindForPayBook;
    private javax.swing.JComboBox cbbBookIDForHistoryBook;
    private javax.swing.JComboBox cbbCategoryForBorrowBook;
    private javax.swing.JComboBox cbbCategoryForMostBorrowedBook;
    private javax.swing.JComboBox cbbDepartmentForBorrowBook;
    private javax.swing.JComboBox cbbDepartmentForEmloyeeBorrowBooks;
    private javax.swing.JComboBox cbbEmployeeForBorrowBook;
    private javax.swing.JComboBox cbbEmployeeIDForHistoryEmployee;
    private com.toedter.calendar.JDateChooser dateIssueForBorrowBook;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel29;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel30;
    private javax.swing.JPanel jPanel31;
    private javax.swing.JPanel jPanel32;
    private javax.swing.JPanel jPanel33;
    private javax.swing.JPanel jPanel34;
    private javax.swing.JPanel jPanel35;
    private javax.swing.JPanel jPanel36;
    private javax.swing.JPanel jPanel37;
    private javax.swing.JPanel jPanel38;
    private javax.swing.JPanel jPanel39;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel40;
    private javax.swing.JPanel jPanel41;
    private javax.swing.JPanel jPanel42;
    private javax.swing.JPanel jPanel43;
    private javax.swing.JPanel jPanel44;
    private javax.swing.JPanel jPanel45;
    private javax.swing.JPanel jPanel46;
    private javax.swing.JPanel jPanel47;
    private javax.swing.JPanel jPanel48;
    private javax.swing.JPanel jPanel49;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel50;
    private javax.swing.JPanel jPanel51;
    private javax.swing.JPanel jPanel52;
    private javax.swing.JPanel jPanel53;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JLabel lblBookIDForHistoryBook;
    private javax.swing.JLabel lblBookNameForHistoryBook;
    private javax.swing.JLabel lblBorrowBooksOverDue;
    private javax.swing.JLabel lblDepartmentForHistoryEmployee;
    private javax.swing.JLabel lblEmployeeBorrowedMost;
    private javax.swing.JLabel lblEmployeeIDForHistoryEmployee;
    private javax.swing.JLabel lblEmployeeNameForFines;
    private javax.swing.JLabel lblEmployeeNameForHistoryEmployee;
    private javax.swing.JLabel lblFindEmployeeForHistoryEmployee;
    private javax.swing.JLabel lblFunction;
    private javax.swing.JLabel lblHistoryBooks;
    private javax.swing.JLabel lblHistoryEmployee;
    private javax.swing.JLabel lblMostBorrowedBook;
    private javax.swing.JLabel lblNumberOfBooksBorrowed;
    private javax.swing.JLabel lblOutstandingBooks;
    private javax.swing.JLabel lblResultNumberOfBookBorrowed;
    private javax.swing.JLabel lblResultOutstandingBooks;
    private javax.swing.JList listBookByCategoryForBorrowBook;
    private javax.swing.JList listBookForBorrowBook;
    private javax.swing.JPanel pnlBookManager;
    private javax.swing.JPanel pnlBorrowBook;
    private javax.swing.JPanel pnlBorrowBooksOverDue;
    private javax.swing.JPanel pnlCart;
    private javax.swing.JPanel pnlCenter;
    private javax.swing.JPanel pnlCertificationForPayBook;
    private javax.swing.JPanel pnlEmployeeBorrowBooks;
    private javax.swing.JPanel pnlEmployeeManager;
    private javax.swing.JPanel pnlEmployeesBorrowedMost;
    private javax.swing.JPanel pnlFindBooksForPayBook;
    private javax.swing.JPanel pnlFines;
    private javax.swing.JPanel pnlHeaderStatistic;
    private javax.swing.JPanel pnlHistoryBooks;
    private javax.swing.JPanel pnlHistoryEmployee;
    private javax.swing.JPanel pnlInformation;
    private javax.swing.JPanel pnlMostBorrowedBook;
    private javax.swing.JPanel pnlPayBook;
    private javax.swing.JPanel pnlPicture;
    private javax.swing.JPanel pnlResultFindForPayBook;
    private javax.swing.JPanel pnlResultForPayBook;
    private javax.swing.JPanel pnlStatistic;
    private javax.swing.JPanel pnlStatisticCenter;
    private javax.swing.JPanel pnlStatisticHistoryBooks;
    private javax.swing.JPanel pnlStatisticHistoryEmployee;
    private javax.swing.JPanel pnlStatisticMostBorrowedBook;
    private javax.swing.JRadioButton rdBookIDForHistoryBook;
    private javax.swing.JRadioButton rdBookTitleForHistoryBook;
    private javax.swing.JRadioButton rdFindEmployeeIDForPayBook;
    private javax.swing.JRadioButton rdFindOrdersIDForPayBook;
    private javax.swing.JTable tblBooksInOrders;
    private javax.swing.JTable tblBooksToPay;
    private javax.swing.JTable tblDetailsBorrowBooksOfEmployee;
    private javax.swing.JTable tblDetailsEmployeePayAFine;
    private javax.swing.JTable tblEmployeeForEmployeeBorrowBooks;
    private javax.swing.JTable tblEmployeesPayAFine;
    private javax.swing.JTable tblHistoryBook;
    private javax.swing.JTable tblHistoryEmployeeForEmployee;
    private javax.swing.JTable tblMostBorrowedBook;
    private javax.swing.JTable tblOrdersDetailsForHistoryEmployee;
    private javax.swing.JTable tblOrdersDetailsForMostBorrowedBook;
    private javax.swing.JTextField txtAmount;
    private javax.swing.JTextField txtBookNameForHistoryBook;
    private javax.swing.JTextField txtCanBorrowBooks;
    private javax.swing.JTextField txtDepartmentForHistoryEmployee;
    private javax.swing.JTextField txtEmployeeIDForPayBookByOrdersID;
    private javax.swing.JTextField txtEmployeeNameForFines;
    private javax.swing.JTextField txtEmployeeNameForHistoryEmployee;
    private javax.swing.JTextField txtEmployeeNameForPayBookByOrdersID;
    private javax.swing.JTextField txtFindForPayBook;
    private javax.swing.JTextField txtFindHistoryBook;
    private javax.swing.JTextField txtFindHistoryEmployee;
    private javax.swing.JTextField txtNumberForBookBorrow;
    // End of variables declaration//GEN-END:variables

    private void initIssueDate() {
        Calendar calendar = new GregorianCalendar();
        dateIssueForBorrowBook.setDateFormatString("MM/dd/yyyy");
        dateIssueForBorrowBook.setCalendar(calendar);
    }
    
    private void loadToCategoryComboBoxModel() {
        this.categoryModel = new DefaultComboBoxModel<Category>();
        for (int i = 0; i < this.manager.getCategoryManager().size(); i++) {
            this.categoryModel.addElement(this.manager.getCategoryManager().get(i));
        }
        this.cbbCategoryForBorrowBook.setModel(categoryModel);
    }
    
    private void loadToDepartmentComboBoxModel() {
        this.departmentModel = new DefaultComboBoxModel<Department>();
        for (int i = 0; i < this.manager.getDepartmentManager().size(); i++) {
            this.departmentModel.addElement(this.manager.getDepartmentManager().get(i));
        }
        this.cbbDepartmentForBorrowBook.setModel(departmentModel);
    }
    
    private void loadToEmployeeComboBoxModelByDepartmentSelected(Department department) {
        this.employeeOfDepartmentModel = new DefaultComboBoxModel<Employee>();
        for (int i = 0; i < this.manager.getEmployeeManager().size(); i++) {
            if (this.manager.getEmployeeManager().get(i).getDepartmentID() == department.getDepartmentID()) {
                this.employeeOfDepartmentModel.addElement(this.manager.getEmployeeManager().get(i));
            }
        }
        this.cbbEmployeeForBorrowBook.setModel(employeeOfDepartmentModel);
        
    }
    
    private void loadToListBookByCategoryForBorrowBookModel(int categoryID) {
        this.listBookForCategoryModel = new DefaultListModel<Book>();
        for (int i = 0; i < this.manager.getBookManager().size(); i++) {
            if (this.manager.getBookManager().get(i).getCategoryID() == categoryID && this.manager.getBookManager().get(i).isIssueStatus() == true) {
                if (!this.checkContainsInModel(this.manager.getBookManager().get(i))) {
                    this.listBookForCategoryModel.addElement(this.manager.getBookManager().get(i));
                }
            }
        }
        this.listBookByCategoryForBorrowBook.setModel(listBookForCategoryModel);
        
        this.listBookCartModel = new DefaultListModel<Book>();
        this.listBookForBorrowBook.setModel(this.listBookCartModel);
    }
    
    private void setTextFields(Employee employee) {
        int count = 0;
        if (employee != null) {
            ArrayList<Integer> alOrdersID = new ArrayList<Integer>();
            for (int i = 0; i < this.manager.getOrdersManager().size(); i++) {
                if (this.manager.getOrdersManager().get(i).getEmployeeID() == employee.getEmployeeID()) {
                    alOrdersID.add(this.manager.getOrdersManager().get(i).getOrdersID());
                }
            }
            
            for (int i = 0; i < this.manager.getOrdersDetailsManager().size(); i++) {
                if (alOrdersID.contains(this.manager.getOrdersDetailsManager().get(i).getOrdersID()) && this.manager.getOrdersDetailsManager().get(i).getReturnDate() == null) {
                    count++;
                }
            }
            this.txtNumberForBookBorrow.setText(String.valueOf(count));
            this.txtCanBorrowBooks.setText(String.valueOf(5 - count));
        } else {
            this.txtNumberForBookBorrow.setText("");
            this.txtCanBorrowBooks.setText("");
        }
    }
    
    private void initJPanelHistoryBook() {
        this.bookForHistoryBookModel = new DefaultComboBoxModel();
        this.cbbBookIDForHistoryBook.setModel(bookForHistoryBookModel);
        this.historyBookModel = new HistoryBookTableModel(manager);
        this.tblHistoryBook.setModel(historyBookModel);
    }
    
    private void loadToBookListModel(int categoryID) {
        this.listBookForCategoryModel.removeAllElements();
        for (int i = 0; i < this.manager.getBookManager().size(); i++) {
            if (categoryID == this.manager.getBookManager().get(i).getCategoryID() && this.manager.getBookManager().get(i).isIssueStatus()) {
                if (!this.listBookCartModel.contains(this.manager.getBookManager().get(i))) {
                    if (!this.checkContainsInModel(this.manager.getBookManager().get(i))) {
                        this.listBookForCategoryModel.addElement(this.manager.getBookManager().get(i));
                    }
                }
            }
        }
        this.listBookByCategoryForBorrowBook.setModel(this.listBookForCategoryModel);
    }
    
    private boolean checkContainsInModel(Book book) {
        for (int i = 0; i < this.listBookForCategoryModel.getSize(); i++) {
            if (book.getTitle().equals(this.listBookForCategoryModel.get(i).getTitle())) {
                return true;
            }
        }
        return false;
    }
    
    private void findBookForPayBook() {
        String textFind = this.txtFindForPayBook.getText().trim().toUpperCase();
        if (rdFindOrdersIDForPayBook.isSelected()) {
            try {
                int ordersID = Integer.valueOf(textFind);
                Orders orders = this.manager.getOrdersManager().getByOrdersID(ordersID);
                if (orders == null) {
                    JOptionPane.showMessageDialog(this, "Coupon code does not exist to borrow this book");
                } else {
                    this.txtEmployeeNameForPayBookByOrdersID.setText(this.manager.getEmployeeManager().getByEmployeeID(orders.getEmployeeID()).getEmployeeName());
                    this.txtEmployeeIDForPayBookByOrdersID.setText(String.valueOf(orders.getEmployeeID()));
                    
                    ArrayList<OrdersDetails> alDetails = this.manager.getOrdersDetailsManager().getListOrdersDetailsUnpaid(ordersID);
                    this.ordersModel.setAlOrdersDetails(alDetails);
                }
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this, "Coupon code is a number of books borrowed");
            }
        } else {
            try {
                int employeeID = Integer.valueOf(textFind);
                Employee employee = this.manager.getEmployeeManager().getByEmployeeID(employeeID);
                if (employee == null) {
                    JOptionPane.showMessageDialog(this, "Code staff does not exist");
                } else {
                    this.txtEmployeeNameForPayBookByOrdersID.setText(employee.getEmployeeName());
                    this.txtEmployeeIDForPayBookByOrdersID.setText(String.valueOf(employeeID));
                    
                    ArrayList<Orders> alOrders = this.manager.getOrdersManager().getByEmployeeIDUnpaid(employeeID);
                    ArrayList<OrdersDetails> alDetails = this.manager.getOrdersDetailsManager().getListOrdersDetailsUnpaid(alOrders);
                    this.ordersModel.setAlOrdersDetails(alDetails);
                }
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this, "Code is a number of employees");
            }
        }
    }
    
    private void createOrders() {
        Calendar calendar = this.dateIssueForBorrowBook.getCalendar();
        
        if (calendar == null || this.listBookCartModel.getSize() == 0) {
            JOptionPane.showMessageDialog(this, "You haven't selected date or books");
        } else {
            Date issueDate = calendar.getTime();
            SimpleDateFormat df = new SimpleDateFormat("dd");
            SimpleDateFormat mf = new SimpleDateFormat("MM");
            SimpleDateFormat yf = new SimpleDateFormat("yyyy");
            
            int today = Integer.valueOf(df.format(issueDate));
            int month = Integer.valueOf(mf.format(issueDate)) - 1;
            int year = Integer.valueOf(yf.format(issueDate));
            Calendar dueCalendar = Calendar.getInstance();
            dueCalendar.set(year, month, today + 5);
            Date dueDate = dueCalendar.getTime();
            
            Orders orders = new Orders(0, ((Employee) this.cbbEmployeeForBorrowBook.getSelectedItem()).getEmployeeID(), issueDate, dueDate, false, true);
            this.manager.getOrdersDB().insert(orders);
            this.manager.getOrdersManager().add(orders);
            
            for (int i = 0; i < this.listBookCartModel.getSize(); i++) {
                OrdersDetails ordersDefails = new OrdersDetails(orders.getOrdersID(), this.listBookCartModel.get(i).getBookID(), null, null, 0, true);
                this.manager.getOrdersDetailsDB().insert(ordersDefails);
                this.manager.getOrdersDetailsManager().add(ordersDefails);
                this.listBookCartModel.get(i).setIssueStatus(false);
                this.manager.getBookDB().update(this.listBookCartModel.get(i));
            }
            
            JOptionPane.showMessageDialog(this, "Created!");
            this.refreshJPanelBorrowBook();
        }
    }
    
    private void putToPayBook(int index) {
        if (index < 0) {
            JOptionPane.showMessageDialog(this, "You have no policy to pay");
        } else {
            OrdersDetails details = this.ordersModel.get(index);
            this.ordersModel.remove(index);
            int days = this.payModel.add(details);
            this.txtAmount.setText(String.valueOf(days * 5));
        }
    }
    
    private void putBackOrders(int index) {
        if (index < 0) {
            JOptionPane.showMessageDialog(this, "You may choose to cancel the settlement policy");
        } else {
            OrdersDetails details = this.payModel.get(index);
            int days = this.payModel.remove(index);
            this.txtAmount.setText(String.valueOf(days * 5));
            this.ordersModel.add(details);
        }
    }
    
    private void addToCart() {
        if ((Employee) this.cbbEmployeeForBorrowBook.getSelectedItem() != null) {
            if (Integer.valueOf(this.txtCanBorrowBooks.getText()) > this.listBookCartModel.getSize()) {
                Book book = (Book) this.listBookByCategoryForBorrowBook.getSelectedValue();
                if (book != null) {
                    this.listBookCartModel.addElement(book);
                    this.listBookForCategoryModel.removeElement(book);
                } else {
                    JOptionPane.showMessageDialog(this, "You haven't selected book");
                }
            } else {
                JOptionPane.showMessageDialog(this, "You can only borrow up to " + this.txtCanBorrowBooks.getText() + " books!");
            }
        } else {
            JOptionPane.showConfirmDialog(this, "No employee borrow book");
        }
    }
    
    private void removeFromCart() {
        Book book = (Book) this.listBookForBorrowBook.getSelectedValue();
        if (book != null) {
            this.listBookCartModel.removeElement(book);
            if (book.getCategoryID() == ((Category) this.cbbCategoryForBorrowBook.getSelectedItem()).getCategoryID()) {
                this.listBookForCategoryModel.addElement(book);
            }
        } else {
            JOptionPane.showMessageDialog(this, "You haven't selected book");
        }
    }
    
    private void findHistoryBook(String text) {
        this.bookForHistoryBookModel.removeAllElements();
        if (this.rdBookIDForHistoryBook.isSelected()) {
            int bookID = 0;
            try {
                bookID = Integer.valueOf(text);
                Book book = this.manager.getBookManager().getByBookID(bookID);
                if (book == null) {
                    JOptionPane.showMessageDialog(this, "No books have id is " + bookID);
                } else {
                    this.bookForHistoryBookModel.addElement(book.getBookID());
                    this.txtBookNameForHistoryBook.setText(book.getTitle());
                    ArrayList<OrdersDetails> alDetails = this.manager.getOrdersDetailsManager().getByBookID(book);
                    this.historyBookModel.setAlOrdersDetailses(alDetails);
                }
            } catch (Exception ex) {
                JOptionPane.showConfirmDialog(this, "BOOKID is a positive number");
            }
        } else {
            ArrayList<Book> alBook = this.manager.getBookManager().getByBookName(text);
            if (alBook.isEmpty()) {
                JOptionPane.showMessageDialog(this, "No books have name is " + text);
            } else {
                this.bookForHistoryBookModel.addElement("All");
                for (Book book : alBook) {
                    this.bookForHistoryBookModel.addElement(book.getBookID());
                }
                this.txtBookNameForHistoryBook.setText(text);
                ArrayList<OrdersDetails> alDetails = this.manager.getOrdersDetailsManager().getByBookID(alBook);
                this.historyBookModel.setAlOrdersDetailses(alDetails);
            }
        }
    }
    
    private void setMenuSelectedStatistic(JPanel pnl, JLabel lbl) {
        pnl.setBackground(Color.WHITE);
        lbl.setForeground(new Color(153, 153, 153));
        if (pnl.getName().equals(this.pnlStatisticHistoryBooks.getName())) {
            this.pnlStatisticHistoryEmployee.setBackground(new Color(153, 153, 153));
            this.lblHistoryEmployee.setForeground(Color.WHITE);
            this.pnlStatisticMostBorrowedBook.setBackground(new Color(153, 153, 153));
            this.lblMostBorrowedBook.setForeground(Color.WHITE);
            this.pnlEmployeesBorrowedMost.setBackground(new Color(153, 153, 153));
            this.lblEmployeeBorrowedMost.setForeground(Color.WHITE);
            this.pnlBorrowBooksOverDue.setBackground(new Color(153, 153, 153));
            this.lblBorrowBooksOverDue.setForeground(Color.WHITE);
        } else if (pnl.getName().equals(this.pnlStatisticHistoryEmployee.getName())) {
            this.pnlStatisticHistoryBooks.setBackground(new Color(153, 153, 153));
            this.lblHistoryBooks.setForeground(Color.WHITE);
            this.pnlStatisticMostBorrowedBook.setBackground(new Color(153, 153, 153));
            this.lblMostBorrowedBook.setForeground(Color.WHITE);
            this.pnlEmployeesBorrowedMost.setBackground(new Color(153, 153, 153));
            this.lblEmployeeBorrowedMost.setForeground(Color.WHITE);
            this.pnlBorrowBooksOverDue.setBackground(new Color(153, 153, 153));
            this.lblBorrowBooksOverDue.setForeground(Color.WHITE);
        } else if (pnl.getName().equals(this.pnlStatisticMostBorrowedBook.getName())) {
            this.pnlStatisticHistoryEmployee.setBackground(new Color(153, 153, 153));
            this.lblHistoryEmployee.setForeground(Color.WHITE);
            this.pnlStatisticHistoryBooks.setBackground(new Color(153, 153, 153));
            this.lblHistoryBooks.setForeground(Color.WHITE);
            this.pnlEmployeesBorrowedMost.setBackground(new Color(153, 153, 153));
            this.lblEmployeeBorrowedMost.setForeground(Color.WHITE);
            this.pnlBorrowBooksOverDue.setBackground(new Color(153, 153, 153));
            this.lblBorrowBooksOverDue.setForeground(Color.WHITE);
        } else if (pnl.getName().equals(this.pnlEmployeesBorrowedMost.getName())) {
            this.pnlStatisticHistoryEmployee.setBackground(new Color(153, 153, 153));
            this.lblHistoryEmployee.setForeground(Color.WHITE);
            this.pnlStatisticMostBorrowedBook.setBackground(new Color(153, 153, 153));
            this.lblMostBorrowedBook.setForeground(Color.WHITE);
            this.pnlStatisticHistoryBooks.setBackground(new Color(153, 153, 153));
            this.lblHistoryBooks.setForeground(Color.WHITE);
            this.pnlBorrowBooksOverDue.setBackground(new Color(153, 153, 153));
            this.lblBorrowBooksOverDue.setForeground(Color.WHITE);
        } else {
            this.pnlStatisticHistoryEmployee.setBackground(new Color(153, 153, 153));
            this.lblHistoryEmployee.setForeground(Color.WHITE);
            this.pnlStatisticMostBorrowedBook.setBackground(new Color(153, 153, 153));
            this.lblMostBorrowedBook.setForeground(Color.WHITE);
            this.pnlStatisticHistoryBooks.setBackground(new Color(153, 153, 153));
            this.lblHistoryBooks.setForeground(Color.WHITE);
            this.pnlEmployeesBorrowedMost.setBackground(new Color(153, 153, 153));
            this.lblEmployeeBorrowedMost.setForeground(Color.WHITE);
        }
    }
    
    private void findHistoryEmployee() {
        String text = this.txtFindHistoryEmployee.getText().trim().toUpperCase();
        this.orderForHistoryEmployeeModel.clear();
        if (text.length() == 0) {
            JOptionPane.showMessageDialog(this, "Employee Name is not blank");
        } else {
            ArrayList<Employee> alEmployees = this.manager.getEmployeeManager().getByEmployeeName(text);
            if (alEmployees.isEmpty()) {
                JOptionPane.showMessageDialog(this, "No existing employee named " + text);
            } else {
                this.historyEmployeeModel.setEmployee(alEmployees.get(0));
                this.txtEmployeeNameForHistoryEmployee.setText(alEmployees.get(0).getEmployeeName());
                this.txtDepartmentForHistoryEmployee.setText(this.manager.getDepartmentManager().getByID(alEmployees.get(0).getDepartmentID()).getDepartmentName());
                this.employeeForHistoryEmployeeModel.removeAllElements();
                for (Employee employee : alEmployees) {
                    this.employeeForHistoryEmployeeModel.addElement(employee.getEmployeeID());
                }
                this.cbbEmployeeIDForHistoryEmployee.setModel(this.employeeForHistoryEmployeeModel);
            }
        }
    }
    
    private void lblMostBorrowedBook() {
        this.setMenuSelectedStatistic(this.pnlStatisticMostBorrowedBook, this.lblMostBorrowedBook);
        this.pnlHistoryBooks.setVisible(false);
        this.pnlHistoryEmployee.setVisible(false);
        this.pnlMostBorrowedBook.setVisible(true);
        this.pnlEmployeeBorrowBooks.setVisible(false);
        this.pnlFines.setVisible(false);
        
        if (this.categoryForMostBorrowedBookModel == null) {
            this.categoryForMostBorrowedBookModel = new DefaultComboBoxModel();
            this.categoryForMostBorrowedBookModel.addElement("All Category");
            for (int i = 0; i < this.manager.getCategoryManager().size(); i++) {
                this.categoryForMostBorrowedBookModel.addElement(this.manager.getCategoryManager().get(i));
            }
            this.cbbCategoryForMostBorrowedBook.setModel(this.categoryForMostBorrowedBookModel);
        }
        this.cbbCategoryForMostBorrowedBook.setSelectedIndex(0);
        
        if (this.mostBorrowedBookModel == null) {
            this.mostBorrowedBookModel = new MostBorrowedBookTableModel(manager);
            this.mostBorrowedBookModel.setAlBook(this.manager.getBookManager().getAllElements());
            this.tblMostBorrowedBook.setModel(this.mostBorrowedBookModel);
            
            this.ordersForMostBorrowedBookModel = new OrdersDetailsByBookIDTableModel(manager);
            this.tblOrdersDetailsForMostBorrowedBook.setModel(this.ordersForMostBorrowedBookModel);
        }
    }
    
    private void lblHistoryEmployee() {
        this.setMenuSelectedStatistic(this.pnlStatisticHistoryEmployee, this.lblHistoryEmployee);
        this.pnlHistoryBooks.setVisible(false);
        this.pnlHistoryEmployee.setVisible(true);
        this.pnlMostBorrowedBook.setVisible(false);
        this.pnlEmployeeBorrowBooks.setVisible(false);
        this.pnlFines.setVisible(false);
        
        if (this.historyEmployeeModel == null) {
            this.historyEmployeeModel = new HistoryEmployeeTableModel(manager);
            this.tblHistoryEmployeeForEmployee.setModel(this.historyEmployeeModel);
            this.orderForHistoryEmployeeModel = new OrderDetailsByOrdersIDTableModel(manager);
            this.tblOrdersDetailsForHistoryEmployee.setModel(this.orderForHistoryEmployeeModel);
            this.employeeForHistoryEmployeeModel = new DefaultComboBoxModel();
            this.cbbEmployeeIDForHistoryEmployee.setModel(this.employeeForHistoryEmployeeModel);
        } else {
            this.txtEmployeeNameForHistoryEmployee.setText("");
            this.employeeForHistoryEmployeeModel.removeAllElements();
            this.historyEmployeeModel.removeAllElements();
        }
    }
    
    private void savePayBook() {
        Calendar calendar = Calendar.getInstance();
        
        if (this.payModel.size() > 0) {
            ArrayList<OrdersDetails> alDetails = new ArrayList<OrdersDetails>();
            for (int i = 0; i < this.payModel.size(); i++) {
                alDetails.add(this.payModel.get(i));
                alDetails.get(i).setReturnDate(calendar.getTime());
                alDetails.get(i).setMoney(Float.valueOf(Integer.valueOf(this.tblBooksToPay.getValueAt(i, 2).toString()) * 5));
                this.manager.getBookManager().getByBookID(this.payModel.get(i).getBookID()).setIssueStatus(true);
            }
            for (OrdersDetails details : alDetails) {
                this.manager.getOrdersDetailsDB().update(details);
                Orders orders = this.manager.getOrdersManager().getByOrdersID(details.getOrdersID());
                if (this.manager.getOrdersDetailsManager().getReturnedOrders(details.getOrdersID())) {
                    orders.setReturned(true);
                }
                this.manager.getOrdersDB().update(orders);
            }
            this.payModel.clear();
        } else {
            JOptionPane.showMessageDialog(this, "No payment policy");
        }
    }
    
    private void lblEmployeeBorrowedBook() {
        if (this.departmentForEmployeeBorrowedMostModel == null) {
            this.departmentForEmployeeBorrowedMostModel = new DefaultComboBoxModel();
            this.departmentForEmployeeBorrowedMostModel.addElement("All Department");
            for (int i = 0; i < this.manager.getDepartmentManager().size(); i++) {
                this.departmentForEmployeeBorrowedMostModel.addElement(this.manager.getDepartmentManager().get(i));
            }
            this.cbbDepartmentForEmloyeeBorrowBooks.setModel(this.departmentForEmployeeBorrowedMostModel);
        }
        this.cbbDepartmentForEmloyeeBorrowBooks.setSelectedIndex(0);
        
        if (this.employeeBorrowBooksModel == null) {
            this.employeeBorrowBooksModel = new EmployeeBorrowBooksTableModel(manager);
            this.tblEmployeeForEmployeeBorrowBooks.setModel(this.employeeBorrowBooksModel);
        }
        this.employeeBorrowBooksModel.setAlEmployee(this.manager.getEmployeeManager().getEmployeeList());
        this.setCountBorrowedBooks();
        
        if (this.detailsEmployeeBorrowBookModel == null) {
            this.detailsEmployeeBorrowBookModel = new DetailsEmployeeBorrowBooksTableModel(manager);
            this.tblDetailsBorrowBooksOfEmployee.setModel(this.detailsEmployeeBorrowBookModel);
        }
        this.detailsEmployeeBorrowBookModel.clear();
    }
    
    private void setCountBorrowedBooks() {
        int numberOfBookBorrowed = 0, oustandingBooks = 0;
        for (int i = 0; i < this.employeeBorrowBooksModel.size(); i++) {
            numberOfBookBorrowed += Integer.valueOf(this.employeeBorrowBooksModel.getValueAt(i, 2).toString());
            oustandingBooks += Integer.valueOf(this.employeeBorrowBooksModel.getValueAt(i, 3).toString());
        }
        this.lblResultNumberOfBookBorrowed.setText(String.valueOf(numberOfBookBorrowed));
        this.lblResultOutstandingBooks.setText(String.valueOf(oustandingBooks));
    }
    
    private void lblEmployeesFines() {
        if (this.employeeFineModel == null) {
            this.employeeFineModel = new EmployeeFineTableModel(manager);
            this.tblEmployeesPayAFine.setModel(this.employeeFineModel);
        }
        this.employeeFineModel.setAlEmployees(this.manager.getEmployeeManager().getEmployeeList());
        
        if (this.employeePayModel == null) {
            this.employeePayModel = new DetailsEmployeePayAFineTableModel(manager);
            this.tblDetailsEmployeePayAFine.setModel(this.employeePayModel);
        }
    }
}
